package com.example.earthquake;

import android.location.Location;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Objects;

public class Earthquake {
    private String mId;
    private Date mDate;
    private String mDetails;
    private Location mLocation;
    private double mMagnitude;
    private String mLink;

    public Earthquake(String id, Date date, String details, Location location, double magnitude, String link) {
        this.mId = id;
        this.mDate = date;
        this.mDetails = details;
        this.mLocation = location;
        this.mMagnitude = magnitude;
        this.mLink = link;
    }

    public String getId() {
        return mId;
    }

    public void setId(String Id) {
        this.mId = Id;
    }

    public Date getDate() {
        return mDate;
    }

    public void setDate(Date Date) {
        this.mDate = Date;
    }

    public String getDetails() {
        return mDetails;
    }

    public void setDetails(String Details) {
        this.mDetails = Details;
    }

    public Location getLocation() {
        return mLocation;
    }

    public void setLocation(Location Location) {
        this.mLocation = Location;
    }

    public double getMagnitude() {
        return mMagnitude;
    }

    public void setMagnitude(double Magnitude) {
        this.mMagnitude = Magnitude;
    }

    public String getLink() {
        return mLink;
    }

    public void setLink(String Link) {
        this.mLink = Link;
    }

    @Override
    public String toString() {
        SimpleDateFormat sdf = new SimpleDateFormat("HH.mm", Locale.US);
        String dateString = sdf.format(mDate);
        return dateString + ": " + mMagnitude + " " + mDetails;
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof Earthquake)
            return (((Earthquake) o).getId().contentEquals(mId));
        else
            return false;
    }
}


